const { Schema, model } = require('mongoose')

const schema = new Schema({
    article: {
        type: Schema.Types.ObjectId,
        ref: 'Article'
    },
    user: {
        type: Schema.Types.ObjectId,
        ref: 'User'
    },
    time: {
        type: Date,
        default: Date.now()
    },
    content: {
        type: String
    }
}, { versionKey: false });

const Comment = model('Comment', schema, 'Comment');

module.exports = { Comment }